home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 1.4 KB | 36 lines | [TEXT/ttxt] |
- resolveRelativeAlias MPW Tool (System 7 only)
-
- Greg Robbins 3/92
-
- Scenario:
-
- A document contains an alias to a file in a known folder. The problem
- is that the document might be on a floppy, and the known folder might
- be on a drive whose name is unknown.
-
- For example, say the boot drive will contain "Super Folder" in the root
- directory, and "Super File" in that folder. The goal is to create an
- alias to "Super File" which will work regardless of the drive's name.
-
- Solution:
-
- Create an alias to the the target (e.g. "SuperFile") which is relative to
- the System file. This presumes that the folder structure of the drive
- is known, but makes no presumption about the name of the drive.
-
- This sample tool demonstrates the steps involved in creating and resolving
- the alias. Instead of creating a document to store the alias, the tool wimps
- out and stores the alias in a preference file.
-
- The tool puts up a StandardGetFile dialog. Selecting a file creates the
- preference file containing the relative alias; clicking Cancel instead
- gets the preference file, resolves it, and prints the vRefNum and name
- of the target.
-
- Alternative strategies:
-
- Well, you could call PBGetVInfo to find the name of the boot volume
- and then build a full pathname, or SetVol to the root directory of the
- boot volume and then use a relative pathname. But both of those
- solutions are ugly and un-Seven like.
-